/**
 * 文件实例转base64
 * @param file
 */
export function fileToBase64(file: File): Promise<string> {
    return new Promise((resolve) => {
        const reader: FileReader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = () => resolve(reader.result as string);
        reader.onerror = (error) => resolve('');
    });
}